<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>context</title>
</head>
<body>
    <div id="app"></div>
</body>
<script src="https://unpkg.com/vue@next"></script>
<script>
    const app = Vue.createApp({
        template: `<div>
            <component-demo title='hello' @change="handleClick">Hello Vue.js</component-demo>
            </div>`,
        setup(props) {
            function handleClick(){
                alert("Hello Vue.js!!!")
               
            }
            return {handleClick}
        }
    })

    app.component('component-demo', {
        setup(props, context) {
            const {h}=Vue;
            const {attrs,slots,emit}=context;
            console.log('attrs.title=',attrs.title)
            console.log('slots=',slots.default ())
            console.log('emit=',emit)
            function handleClick(){
                emit:('change')
            }
            return{handleClick}
        },
        template: `
            <div @click="handleClick"> child </div>
        `
    })

    const vm = app.mount("#app")
</script>
</html>